package com.douqu.game.core.config.map;

import com.douqu.game.core.config.common.CommonData;
import com.douqu.game.core.entity.GameObject;
import com.douqu.game.core.util.LoadUtils;
import com.douqu.game.core.util.LogUtils;

/**
 * @Author: Bean
 * @Description:
 * @Date: 2018-04-19 19:15
 */
public class CityArmyGroupConfig extends GameObject {

    public int group;

    /**
     * 怪物组参数
     */
    public int[] monsterLv;

    public CommonData[] paraments;

    public int fc;



    @Override
    public boolean check()
    {
        if(monsterLv == null || monsterLv.length != 14)
        {
            LogUtils.error(getClass().getSimpleName() + " Load BattleInitConfig monsterLv is null! id:" + id);
            return false;
        }
        if(paraments == null){
            LogUtils.error(getClass().getSimpleName() + " Load BattleInitConfig paraments is null! id:" + id);
            return false;
        }

        return super.check();
    }


    public int getLv()
    {
        return monsterLv[0];
    }

    public int getStar()
    {
        return monsterLv[1];
    }

    @Override
    public boolean setVariable(String key, String value)
    {
        if("monsterLv".equals(key))
        {
            monsterLv = LoadUtils.loadIntArray(key, value);
            return true;
        }
        else if ("paraments".equals(key)){
            paraments = LoadUtils.loadCommonDataToArray(key, value);
            return true;
        }
        else
            return super.setVariable(key, value);
    }
}
